<?php
require_once("checklogin.php");
require_once("classQuanTriTin.php");
$qt = new quantritin;


//Xóa 1 hình
if (isset($_GET['idHinh'])==true){
	$idHinh = $_GET['idHinh']; 
	settype($idHinh,"int");
	$qt->XoaHinhAnh($idHinh);
	if (strlen($_SESSION['back'])>0)
	{
		$back = $_SESSION['back']; unset($_SESSION['back']);
		header("location:$back");
	} 
	else 
		header("location:main.php?p=hinhanh_list");
}

//Xóa nhiều tin
if (isset($_GET['listid'])==true){
	$listid = explode(",",$_GET['listid']); 
	for ($i=0 ; $i<count($listid) ; $i++){
		$idHinh = $listid[$i]; 	
		$qt->XoaHinhAnh($idHinh);
	}
	if (strlen($_SESSION['back'])>0)
	{
		$back = $_SESSION['back']; unset($_SESSION['back']);
		header("location:$back");
	} 
	else 
		header("location:main.php?p=hinhanh_list");

}
?>